package org.monster.uiboot;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * 命令活动
 */
public class CommandAction extends ItemAction implements ActionListener {

    /**
     * 文本字段
     */
    private JTextField textField;

    /**
     * 构造方法
     * @param textField 文本字段
     */
    public CommandAction(JTextField textField) {
        super(null);
        this.textField = textField;
    }

    /**
     * 活动执行
     *
     * @param e 活动事件
     */
    @Override
    public void actionPerformed(ActionEvent e) {
        if (textField.getText() != "" || textField.getText() != null) {
            receiver.receive(textField.getText());
        }
    }

}
